<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <div id="test">
    <!-- 
      v-once: 标识一个结构初始显示后, 不会再更新, 用于不变的数据显示 => 优化内部解析的性能
      v-pre: 直接将结构html显示(不解析指令/插值语法)  可用于直接显示插值语法代码
     -->
    <div v-once>
      <h2>用户名-{{userInfo.username}}</h2>
      <h3>身价是-{{userInfo.price}}</h3>
    </div>

    <div v-pre>
      <h2 v-if="false">用户名-{{userInfo.username}}</h2>
      <h3>身价是-{{userInfo.price}}</h3>
    </div>
  </div>

  <script src="../js/vue.js"></script>
  <script>
    const vm = new Vue({
      el: "#test",
      data: {
        userInfo: {
          username: 'tom',
          price: 12000
        }
      }
    })

    setTimeout(() => {
      vm.userInfo.username = 'Jack'
    }, 2000);
  </script>
</body>
</html>